const path = require('path')

const htmlWebpackPlugin = require('html-webpack-plugin')

const htmlPlugin = new htmlWebpackPlugin({
    template: path.join(__dirname,'./src/index.html'),
    filename: 'index.html'
})

module.exports = {
    mode: 'development',
    // mode: 'production',
    plugins: [
        htmlPlugin
    ],
    module: {
        rules: [
            {test: /\.js|jsx$/, use: 'babel-loader', exclude: /node_modules/},
            {test: /\.css$/, use: ['style-loader','css-loader']},
            {test: /\.less$/, use: ['style-loader','css-loader','less-loader']},
            {test: /\.ttf|woff|eot|svg$/, use: 'url-loader'},
            {
                test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
                loader: require.resolve('url-loader'),
                options: {
                    limit: 10000,
                    name: '[name].[hash:8].[ext]',
                },
            },

        ],


    },
    resolve: {
        alias:{
            "@": path.join(__dirname, './src')
        }
    },
}